﻿#include "kdpch.h"
#include "Texture.h"

#include "KuaDu/Renderer/Renderer.h"
#include "Platform/OpenGL/OpenGLTexture.h"

namespace KD {

    Ref<Texture2D> Texture2D::Create(uint32_t width, uint32_t height)
    {
        switch (Renderer::GetAPI())
        {
        case RendererAPI::API::None: KD_CORE_ASSERT(false, "目前不支持RendererAPI::None！");
        case RendererAPI::API::OpenGL: return CreateRef<OpenGLTexture2D>(width, height);
        }
        KD_CORE_ASSERT(false, "未知的渲染API");
        return Ref<Texture2D>();
    }

    Ref<Texture2D> Texture2D::Create(const std::string& path)
    {
        switch (Renderer::GetAPI())
        {
            case RendererAPI::API::None : KD_CORE_ASSERT(false, "目前不支持RendererAPI::None！");
            case RendererAPI::API::OpenGL : return CreateRef<OpenGLTexture2D>(path);
        }
        KD_CORE_ASSERT(false, "未知的渲染API");
        return nullptr;
    }

}